<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <link href="prettify.css" type="text/css" rel="stylesheet" />
    <link href="styles.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="prettify.js"></script>
    <title>Patterns for LocalTime values</title>
  </head>
  <body onload="prettyPrint()">
    <h1>Patterns for LocalTime values</h1>
    <p>The <a href="../api/html/T_NodaTime_LocalTime.htm"><code>LocalTime</code></a> type supports the following patterns:</p>

<h2>Standard Patterns</h2>

<p>The following standard patterns are supported:</p>

<ul>
<li><p><code>t</code>: Short format pattern.<br />
This is the short time pattern as defined by the culture's <a href="http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.shorttimepattern.aspx"><code>DateTimeFormatInfo.ShortTimePattern</code></a> 
For example, in the invariant culture this is "HH:mm".</p></li>
<li><p><code>T</code>: Long format pattern.<br />
This is the long time pattern as defined by the culture's <a href="http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.longtimepattern.aspx"><code>DateTimeFormatInfo.LongTimePattern</code></a> 
For example, in the invariant culture this is "HH:mm:ss".</p></li>
<li><p><code>r</code>: Round-trip pattern.<br />
This always uses a pattern of "HH:mm:ss.FFFFFFF", but with the culture-specific time separator.</p></li>
</ul>

<h2>Custom Patterns</h2>

<p>The following custom offset pattern characters are supported for local times. See <a href="text.html#custom-patterns">custom pattern notes</a>
for general notes on custom patterns, including characters used for escaping and text literals.</p>

<table>
  <thead>
    <tr>
      <td>Character</td>
      <td>Meaning</td>
      <td>Example</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>H</code> or <code>HH</code></td>
      <td>
        The hour of day in the 24-hour clock; a value 0-23.
      </td>
      <td>
        7.30am: <code>H:mm</code> => <code>7:30</code> <br />
        7.30am: <code>HH:mm</code> => <code>07:30</code>
      </td>
    </tr>
    <tr>
      <td><code>h</code> or <code>hh</code></td>
      <td>
        The hour of day in the 12-hour clock; a value 1-12. When parsing, if no
        am/pm designator is specified, the parsed value is in the morning.
      </td>
      <td>
        8.30pm: <code>H:mm</code> => <code>7:30</code> <br />
        8.30pm: <code>HH:mm</code> => <code>07:30</code>
      </td>
    </tr>
    <tr>
      <td><code>m</code> or <code>mm</code></td>
      <td>
        Number of minutes within the hour. <code>mm</code> is zero-padded; <code>m</code> is not.
      </td>
      <td>
        5 minutes: <code>m:ss</code> => <code>5:00</code> <br />
        5 minutes: <code>mm:ss</code> => <code>05:00</code>
      </td>
    </tr>
    <tr>
      <td><code>s</code> or <code>ss</code></td>
      <td>
        Number of seconds within the minute. <code>ss</code> is zero-padded; <code>s</code> is not.
      </td>
      <td>
        5 seconds: <code>s.fff</code> => <code>5.000</code> <br />
        5 seconds: <code>ss.fff</code> => <code>05.000</code>
      </td>
    </tr>
    <tr>
      <td><code>f</code>, <code>ff</code> ... up to <code>fffffff</code></td>
      <td>
        The fractional second part of the offset, using exactly the specified number of characters
        (up to 7, for a representation accurate to a tick).
      </td>
      <td>
        1 second, 340 milliseconds: <code>s.fff</code> => 340 <br />
        1 second, 340 milliseconds: <code>s.ff</code> => 34 <br />
        1 second, 340 milliseconds: <code>s.f</code> => 3 <br />
      </td>
    </tr>
    <tr>
      <td><code>F</code>, <code>FF</code> ... up to <code>FFFFFFF</code></td>
      <td>
        The fractional second part of the offset, using at most the specified number of characters
        (up to 7, for a representation accurate to a tick).
        Trailing digits are truncated towards zero, and trailing insignificant zeroes are truncated.
        If this comes after a period (".") and the value is zero, the period is
        also truncated.
      </td>
      <td>
        1 second, 340 milliseconds: <code>s.FFF</code> => <code>1.34</code> <br />
        1 second, 340 milliseconds: <code>s.FF</code> => <code>1.34</code> <br />
        1 second, 340 milliseconds: <code>s.F</code> => <code>1.3</code> <br />
        Exactly 1 second: <code>s.F</code> => <code>1</code> <br />
      </td>
    </tr>
    <tr>
      <td><code>t</code> or <code>tt</code></td>
      <td>
        The culture-specific AM/PM designator, either in full (for <code>tt</code>) or just the first character
        (for <code>t</code>).
      </td>
      <td>
        13:10: <code>h:mm tt</code> => <code>1:10 PM</code>
        13:10: <code>h:mm:sst</code> => <code>1:10:00P</code>
      </td>
    </tr>
    <tr>
      <td><code>.</code></td>
      <td>
        This is *always* a period ("."); not a culture-sensitive decimal separator as one might expect. This
        follows the example of other standard libraries, however odd it may appear. The only difference
        between a period and any other literal character is that when followed by a series of "F" characters,
        the period will be removed if there are no fractional seconds.
      </td>
      <td>
        12 seconds, 500 milliseconds (en-US): <code>ss.FFF</code> => <code>12.5</code>
        12 seconds, 500 milliseconds (fr-FR): <code>ss.FFF</code> => <code>12.5</code>
      </td>
    </tr>
    <tr>
      <td><code>:</code></td>
      <td>
        The time separator for the format provider; colon in the invariant colture.
      </td>
      <td><code>HH:mm</code> => <code>07:30</code></td>
    </tr>
  </tbody>

</table>

  </body>
</html>
